<script setup lang="ts">
import type { HeadlineItem } from "@/type/lidare"
import {useRouter} from "vue-router"
const props = defineProps<{
  item: HeadlineItem
}>();
const router = useRouter();
const toDetail = () => {
  console.log(props.item);
  router.push({
    name:"headlinedetail",
    params:{
      id:props.item.id
    }
  });
}
</script>
<template>
  <div class="headline-item" @click.stop="toDetail">
    <div class="header">
      <div class="img-box">
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="35px" height="35px">
          <image x="0px" y="0px" width="35px" height="35px"
            xlink:href="data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAYAAAAe2bNZAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH5wMIECAXT/DRsAAAB9hJREFUWMOlmOtvXMUZxn8z55y92l6v7bXXOA6EBGgIIVwa7lUbhVRqK/GJv7OVqkqoQoWilgAlXBIlxE0ITmLHzvq2673vOTPz9sOs117bSUwZabR75j0z88x7m+c9SkSEozQnSLONbNaw9x7illZxa1VotBBjUWEIhRH0dJHg6Vn0fBk1WUDlsqDVkbYIj4RjvYr5+gb2xh1cZQupNZB2B7oxYgw4Aa1RUQiZFCqfRY2PosuThC8/T/Dar9AThSfuox6pGRGk3sJe/5Hk399jFxY9iDiBoyhTa1Q6QhXHCM6cJHr3FYLTJ1Cj+Z8Pxi1XSD7+kuTKDdzKOtKNh0AoNcD8hOOCymXQc9NEb58juvAGujx5NDBiLfbWfeK/fYb59iay3UCsAHJwFz/jkLG9YPvyIEBPjBG9+TKpP7xHcGIOAv14MObmIr2//ANz5QbS6hzNJEdtSqEKI0RvnSP9we8ITs0PiXcdWAS3XCH+66ckX19HWu2DyvilTQSp1Ukuf4eKAtIfXkLPlgbigZ6k3qL3989JrlxHmi1wzmtFXN8U0n+W3fGj9sF8B87hthvEX1wl/uQ/SKN1EExydYHkq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yQ8zSQ+zSCihFMD/rNa2UN+d2A0kMeqqIvb+Ca7UG2VrnMgSlCcLw5HFUPgvV2j7u4hOeWVzGLK2gUj6s6fZQIznMvRWk2SfjuZyXmQSMQRLjTxuGYCySJEOcBuln4f7pdWGU4Ok5wvDEPHp8FPtgFXGHEBhnwVqiF095dVtH8NQMEse4jSquWvcOGwZIt4fKZ5E4QaVT6MIort7E3HuAXV07cFAAFQboqXHC+TJhMD1JMDdDcmsRTHeICO2dFMyV0WOjqEwKXZrsE6UGycId9EQBVRiFXoyeKiKNNqQjgqkirloHEexKZS/L2v2byRLMzaAni4RqJEf6/DniawuY5dV97G73IVm4g8rnUFHow1IppNvDVjbQtW1UNo10uqhsFoljn4lzOSSOsZV1DuX9ShGWS6RePYPK5wjRmvS7r9O7cg27WfUZ8zAw/72zT837Fz+EsO+5aL2mh31Sj42Rev0lUr8+C1p5cqWnimQuvUc4P9uP/30sbx+xErE8mfUN04oDhC1QhKeeJvPbN9FFX+ANCHnqldNkLryF3djCrm/8TDL+iDrwMYsE5WkyF94i9eJzg7EBGD02Su5PF7Frm7Q//pcnWzt2VurQKulAGaP21dSHyZUimJogc/Fdsu+/N1RhDtXawbEy+Q//iBhD55PP+4D8onKUzQ6o5qA8KE2S/f1vyH3wPkG5NCQ7WN5aS3J7kdafP6Lz6ZfYyrqnDr+0hSHhXJnsJQ8kOnH8yRXlANPyKq2P/kn3sy9Ibi3iGi1+niOpwY8ujJF64STZi++QvfQbgvL04TMe933G1RvEV2/S+fQyvSvXMKsVXLsL9giaCkN0Lkt4rEzmjVfJXnib6Mzz6JH/4yvEkJbWt+h9+S29qzcwyw+xlXXsVs3fTd0e4hwqCFCZNHok77PpTIlwfpb0a2dJnz+Hnhh/si6P/uXK4Rot3MYWyd1lzL0l7NqGZ4DGoqLQX3gzJaJn5gmPz3m6kc8NONCT2v8AbGKRCupa9kUAAAAASUVORK5CYII=" />
        </svg>
      </div>
      <div class="author">{{ props.item.author }}</div>
    </div>
    <div class="title">{{ props.item.title }}</div>
    <div class="img-box" :style="{ backgroundImage: `url(${props.item.cover})` }">
    </div>
    <div class="des">
      <div class="isTop" v-if="props.item.isTop == '2'">推荐</div>
      <div class="time">{{ props.item.tranTime }}</div>
      <div class="likes"><van-icon class="icon" name="eye-o" /><span>{{ props.item.likeNum }}</span></div>
    </div>
  </div>
</template>
<style lang="scss" scoped>
.headline-item {
  width: 100%;
  overflow: hidden;
  border-radius: .12rem;
  box-sizing: border-box;
  padding: .1rem;
  background-color: var(--bgc-white);
  font-size: .15rem;
  margin-bottom: .2rem;

  .header {
    width: 100%;
    height: .36rem;
    display: flex;
    align-items: center;
    padding-bottom: .1rem;

    .img-box {
      width: .36rem;
      height: .36rem;
      border-radius: 50%;
    }

    .author {
      margin-left: .1rem;
      color: var(--text-gray);
    }
  }

  .title {
    padding-bottom: .1rem;
  }

  .img-box {
    width: 100%;
    height: 1.34rem;
    border-radius: .1rem;
    overflow: hidden;
  }

  .des {
    display: flex;
    align-items: center;
    font-size: .12rem;
    color: var(--text-gray);
    box-sizing: border-box;
    padding: 0 .1rem;
    padding-top: .1rem;

    .isTop {
      height: .18rem;
      line-height: .18rem;
      padding: 0 .05rem;
      color: var(--text-white);
      background-color: var(--bgc-red);
      border-radius: .02rem;
    }

    .time {
      margin-left: .04rem;
    }

    .likes {
      margin-right: 0;
      margin-left: auto;
      display: flex;
      align-items: center;

      .icon {
        margin-right: .02rem;
      }
    }
  }
}
</style>